/*
 * @Descripttion: GGB
 * @version: 1.0
 * @Author: GGB
 * @Date: 2021-08-17 10:53:14
 * @LastEditors: GGB
 * @LastEditTime: 2021-08-18 06:48:49
 */
import 'package:flutter/material.dart';
import 'package:flutter_data_center/controller/door_controller.dart';
import 'package:get/get.dart';
import './components/door_list.dart';
import './components/door_statistics.dart';

class DoorScreen extends StatefulWidget {
  const DoorScreen({Key key}) : super(key: key);
  static String routeName = "/door";

  @override
  _DoorScreenState createState() => _DoorScreenState();
}

class _DoorScreenState extends State<DoorScreen> {
  DoorController _doorController = Get.put(DoorController());
  @override
  void initState() {
    super.initState();
    // 发起数据请求
    _doorController.getDoors();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      backgroundColor: Colors.white,
      body: SafeArea(
        child: SingleChildScrollView(
          physics: BouncingScrollPhysics(),
          child: Padding(
            padding: const EdgeInsets.all(30),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.center,
              children: [
                DoorStatistics(),
                SizedBox(height: 30),
                DoorList(),
              ],
            ),
          ),
        ),
      ),
    );
  }
}
